<?php

require_once 'JSCasts/Path/Abstract.php';

class JSCasts_Path_Route
extends JSCasts_Path_Abstract  
{
    const INDEX_RESOURCE = 0;
    const INDEX_ID       = 1;
    const INDEX_ACTION   = 2;
    const INDEX_PARAM    = 3;
    
    protected $delimiter = '/';
    
    public function validate()
    {
        // TODO: check to see if the components[0] class exists.
        return false;
    }
    
    public function __toString()
    {
        return $this->delimiter . parent::__toString();
    }
    
    public function resource()
    {
        return $this->component(self::INDEX_RESOURCE);
    }
    
    public function identifier()
    {
        return $this->component(self::INDEX_ID);
    }
    
    public function action()
    {
        return $this->component(self::INDEX_ACTION);
    }
    
    public function param($index)
    {
        return $this->component(self::INDEX_PARAM + $index);
    }
}